home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / DELPHI32 / DATETIME / TIMESTOP / TIMESTOP.PAS < prev    next >
Pascal/Delphi Source File  |  1996-07-10  |  1KB  |  76 lines

  1. unit TimeStop;
  2.  {
  3.  
  4.  Copyriht Bj°rn M. Jacobsen 1996
  5.  Bjorn Jacobsen <Safetec @ internet.no>
  6.  
  7.  This component is FREEWARE .
  8.  }
  9. interface
  10.  
  11. uses
  12.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
  13.  
  14. type
  15.   TTimeStop = class(TComponent)
  16.  
  17.   private
  18.    FDate:string;
  19.     { Private declarations }
  20.   protected
  21.     { Protected declarations }
  22.   public
  23.       constructor Create(AOwner : TComponent); override;
  24.       Destructor Destroy;override;
  25.        procedure Execute;
  26.     { Public declarations }
  27.   published
  28.       property Date :string read Fdate write FDate ;
  29.       property Name;
  30.       Property Tag;
  31.     { Published declarations }
  32.   end;
  33.  
  34. procedure Register;
  35.  
  36. implementation
  37.  
  38. procedure Register;
  39. begin
  40.   RegisterComponents('Samples', [TTimeStop]);
  41. end;
  42.  
  43. constructor TTimeStop.Create(AOwner : TComponent);
  44. begin
  45.   inherited Create(AOwner);
  46.   FDate:='31,12,99';
  47. end;
  48.  
  49. Destructor TTimestop.Destroy;
  50. begin
  51. inherited Destroy ;
  52. end;
  53. procedure TTimestop.Execute;
  54. var fra,tid2,dag:string[20];
  55. begin
  56. tid2:=FormatDateTime('yy,mm,dd',now);
  57. dag:=tid2[1]+tid2[2]+tid2[4]+tid2[5]+tid2[7]+tid2[8];  // formats like'991231'
  58.  
  59. if length(FDATE)>10 then Fdate:='31,12,99';
  60. fra:=Fdate[7]+Fdate[8]+Fdate[4]+Fdate[5]+Fdate[1]+Fdate[2];   // formats like'991231'
  61.  
  62. if strtoint(dag)>=strtoint(fra) then  begin
  63. application.messagebox(' Now is the time to PAY...','TimeStop.',mb_ok);
  64. application.terminate;
  65.  
  66. end;
  67.  
  68. end;
  69.  
  70.  
  71.  
  72.  
  73.  
  74. end.
  75.  
  76.